package com.tang.common.config.feignConfig;

import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.apache.shiro.SecurityUtils;

public class ShiroJwtHeaderInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate template) {
        Object principal = SecurityUtils.getSubject().getPrincipal();
        if (principal != null && !"".equals(principal)){
            template.header("massToken", principal.toString());
        }
    }
}
